zaidmehdi commited on
Commit
d93cfa5
1 Parent(s): cfb3f1b

specify server andport

Browse files
Files changed (1) hide show
  1. src/main.py +28 -26
src/main.py CHANGED
@@ -41,33 +41,35 @@ def classify_arabic_dialect(text):
41
 
42
  return predictions
43
 
44
-
45
- with gr.Blocks() as demo:
46
- gr.HTML(index_html)
47
-
48
- input_text = gr.Textbox(label="Your Arabic Text")
49
- submit_btn = gr.Button("Submit")
50
- predictions = gr.Label(num_top_classes=3)
51
- submit_btn.click(
52
- fn=classify_arabic_dialect,
53
- inputs=input_text,
54
- outputs=predictions)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
 
56
- gr.Markdown("## Text Examples")
57
- examples = gr.Examples(
58
- examples=[
59
- "واش نتا خدام ولا لا",
60
- "بصح راك فاهم لازم الزيت",
61
- "حضرتك بروح زي كدا؟ على طول النهار ده",
62
- ],
63
- inputs=input_text,
64
- )
65
- gr.HTML("""
66
- <p style="text-align: center;font-size: large;">
67
- Checkout the <a href="https://github.com/zaidmehdi/arabic-dialect-classifier">Github Repo</a>
68
- </p>
69
- """)
70
 
71
 
72
  if __name__ == "__main__":
73
- demo.launch()
 
41
 
42
  return predictions
43
 
44
+ def main():
45
+ with gr.Blocks() as demo:
46
+ gr.HTML(index_html)
47
+
48
+ input_text = gr.Textbox(label="Your Arabic Text")
49
+ submit_btn = gr.Button("Submit")
50
+ predictions = gr.Label(num_top_classes=3)
51
+ submit_btn.click(
52
+ fn=classify_arabic_dialect,
53
+ inputs=input_text,
54
+ outputs=predictions)
55
+
56
+ gr.Markdown("## Text Examples")
57
+ examples = gr.Examples(
58
+ examples=[
59
+ "واش نتا خدام ولا لا",
60
+ "بصح راك فاهم لازم الزيت",
61
+ "حضرتك بروح زي كدا؟ على طول النهار ده",
62
+ ],
63
+ inputs=input_text,
64
+ )
65
+ gr.HTML("""
66
+ <p style="text-align: center;font-size: large;">
67
+ Checkout the <a href="https://github.com/zaidmehdi/arabic-dialect-classifier">Github Repo</a>
68
+ </p>
69
+ """)
70
 
71
+ demo.launch(server_name="0.0.0.0", server_port=8080)
 
 
 
 
 
 
 
 
 
 
 
 
 
72
 
73
 
74
  if __name__ == "__main__":
75
+ main()