Update app.py
Browse files
app.py
CHANGED
|
@@ -2,18 +2,22 @@ import gradio as gr
|
|
| 2 |
import os, shutil, time
|
| 3 |
from gradio_client import Client
|
| 4 |
client = Client("ByteDance/Hyper-SDXL-1Step-T2I")
|
|
|
|
| 5 |
def multimodalResponse(message,history):
|
| 6 |
-
|
| 7 |
print(message)
|
| 8 |
result = client.predict(
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
shutil.copy(result[0]['image'],os.getcwd())
|
| 16 |
-
os.rename('image.webp', 'image'+
|
| 17 |
return "Prompt '"+message+"': +"/image"+length+".webp)"
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
import os, shutil, time
|
| 3 |
from gradio_client import Client
|
| 4 |
client = Client("ByteDance/Hyper-SDXL-1Step-T2I")
|
| 5 |
+
id=0
|
| 6 |
def multimodalResponse(message,history):
|
| 7 |
+
id=id+1
|
| 8 |
print(message)
|
| 9 |
result = client.predict(
|
| 10 |
+
num_images=1,
|
| 11 |
+
height=1024,
|
| 12 |
+
width=1024,
|
| 13 |
+
prompt=message,
|
| 14 |
+
seed=3413,
|
| 15 |
+
api_name="/process_image")
|
| 16 |
shutil.copy(result[0]['image'],os.getcwd())
|
| 17 |
+
os.rename('image.webp', 'image'+str(id)+'.webp')
|
| 18 |
return "Prompt '"+message+"': +"/image"+length+".webp)"
|
| 19 |
+
bot=gr.Chatbot(
|
| 20 |
+
value=[[None,"I'm a simple image-generating chatbot. Please tell me what you would like to see."]],
|
| 21 |
+
render_markdown=True)
|
| 22 |
+
interface=gr.ChatInterface(multimodalResponse,chatbot=bot, multimodal=False)
|
| 23 |
+
interface.launch(allowed_paths=["."])
|