chansung commited on
Commit
016174f
1 Parent(s): f28f0b8

Update app/main.py

Browse files
Files changed (1) hide show
  1. app/main.py +16 -7
app/main.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import gradio as gr
2
  from openai import AsyncOpenAI
3
 
@@ -50,11 +51,19 @@ async def echo(message, history):
50
  full_resp = full_resp + resp.choices[0].delta.content
51
  yield full_resp
52
 
53
- demo = gr.ChatInterface(
54
- fn=echo,
55
- examples=["hello", "how are you?", "What is Large Language Model?"],
56
- title="Space of Gradio Text Generation Inference",
57
- multimodal=False
58
- )
 
 
 
59
 
60
- demo.queue().launch(server_name="0.0.0.0", server_port=3000)
 
 
 
 
 
 
1
+ import argparse
2
  import gradio as gr
3
  from openai import AsyncOpenAI
4
 
 
51
  full_resp = full_resp + resp.choices[0].delta.content
52
  yield full_resp
53
 
54
+ def main(args):
55
+ demo = gr.ChatInterface(
56
+ fn=echo,
57
+ examples=["hello", "how are you?", "What is Large Language Model?"],
58
+ title="Space of Gradio ➕ Text Generation Inference",
59
+ multimodal=False
60
+ )
61
+
62
+ demo.queue().launch(server_name="0.0.0.0", server_port=args.port)
63
 
64
+ if __name__ == "__main__":
65
+ parser = argparse.ArgumentParser(description="This is my Gradio app's description")
66
+ parser.add_argument("--port", type=int, default=7860, help="Port to expose Gradio app")
67
+
68
+ args = parser.parse_args()
69
+ main(args)