Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,22 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
def greet(name):
|
4 |
return "Hello " + name + "!!"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
-
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
7 |
demo.launch(share=True)
|
|
|
1 |
import gradio as gr
|
2 |
+
import requests
|
3 |
+
import json
|
4 |
+
|
5 |
+
URL = "198.175.88.52"
|
6 |
+
myport = "8080"
|
7 |
+
gaudi_device_url = f"http://{URL}:{myport}/generate"
|
8 |
|
9 |
def greet(name):
|
10 |
return "Hello " + name + "!!"
|
11 |
+
|
12 |
+
def text_gen(url, prompt):
|
13 |
+
resp = requests.post(url, prompt=json.dumps(prompt))
|
14 |
+
return resp
|
15 |
+
|
16 |
+
demo = gr.Interface(
|
17 |
+
fn=text_gen,
|
18 |
+
inputs=[gaudi_device_url, "text"],
|
19 |
+
outputs=["text"], )
|
20 |
|
21 |
+
#demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
22 |
demo.launch(share=True)
|