Spaces:
Runtime error
Runtime error
uppdate app.py
Browse files
app.py
CHANGED
|
@@ -1,24 +1,15 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
def greet(name):
|
| 4 |
return "Hello " + name + "!!"
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
headers = {"Authorization": "Bearer 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"}
|
| 12 |
|
| 13 |
-
|
| 14 |
-
response = requests.post(API_URL, headers=headers, json=payload)
|
| 15 |
-
return response.content
|
| 16 |
-
image_bytes = query({
|
| 17 |
-
"inputs": "Astronaut riding a horse",
|
| 18 |
-
})
|
| 19 |
-
# You can access the image with PIL.Image for example
|
| 20 |
-
import io
|
| 21 |
-
from PIL import Image
|
| 22 |
-
image = Image.open(io.BytesIO(image_bytes))
|
| 23 |
-
gr.Interface.load("models/runwayml/stable-diffusion-v1-5").launch()
|
| 24 |
-
iface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import requests
|
| 3 |
+
import io
|
| 4 |
+
from PIL import Image
|
| 5 |
|
| 6 |
def greet(name):
|
| 7 |
return "Hello " + name + "!!"
|
| 8 |
|
| 9 |
+
demo = gr.Interface(
|
| 10 |
+
fn=greet,
|
| 11 |
+
inputs=gr.Textbox(lines=2, placeholder="Name Here..."),
|
| 12 |
+
outputs="text",
|
| 13 |
+
)
|
|
|
|
| 14 |
|
| 15 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|