Spaces:
Runtime error
Runtime error
Update app/main.py
Browse files- 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 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
|
|
|
|
|
|
59 |
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
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)
|