Spaces:
Runtime error
Runtime error
created app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import io
|
| 3 |
+
from PIL import Image
|
| 4 |
+
def query(payload):
|
| 5 |
+
response = requests.post(API_URL, headers=headers, json=payload)
|
| 6 |
+
image_bytes = response.content
|
| 7 |
+
image = Image.open(io.BytesIO(image_bytes))
|
| 8 |
+
return image
|
| 9 |
+
|
| 10 |
+
demo = gr.Interface(fn=query, inputs="text", outputs="image")
|
| 11 |
+
|
| 12 |
+
if __name__ == "__main__":
|
| 13 |
+
demo.launch(share = True)
|