Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,18 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import replicate
|
| 3 |
|
| 4 |
+
# Authenticate with Replicate
|
| 5 |
+
replicate.Client(api_token="r8_bf0m2SnfXi6m1YcVGuAxekbghbxVfE02qgTqV")
|
| 6 |
+
|
| 7 |
+
# Define a function to use the model
|
| 8 |
+
def generate_image(prompt):
|
| 9 |
+
model = replicate.models.get("xarty8932/dream")
|
| 10 |
+
version = model.versions.get("5e3c45aa9c9896f86634175309490225e5a379a6a81c39abbf55eab2cd16b657")
|
| 11 |
+
output = version.predict(prompt=prompt)
|
| 12 |
+
return output
|
| 13 |
+
|
| 14 |
+
# Create a Gradio interface
|
| 15 |
+
iface = gr.Interface(fn=generate_image, inputs="text", outputs="image")
|
| 16 |
+
|
| 17 |
+
# Launch the interface
|
| 18 |
+
iface.launch()
|