Update app.py
Browse files
app.py
CHANGED
|
@@ -112,15 +112,15 @@ def generate_text(prompt, system_prompt):
|
|
| 112 |
{"role": "user", "content": prompt}
|
| 113 |
]
|
| 114 |
try:
|
| 115 |
-
|
| 116 |
account_id=ACCOUNT_ID,
|
| 117 |
model=CHAT_MODEL,
|
| 118 |
messages=messages,
|
| 119 |
)
|
| 120 |
|
| 121 |
-
print(f'response: {response}')
|
| 122 |
|
| 123 |
-
return response
|
| 124 |
|
| 125 |
except Exception as e:
|
| 126 |
raise gr.Error(str(e))
|
|
@@ -128,7 +128,7 @@ def generate_text(prompt, system_prompt):
|
|
| 128 |
|
| 129 |
def gen(promtp: str, system_prompt: str):
|
| 130 |
text = generate_text(promtp, system_prompt)
|
| 131 |
-
image = generate_image(text)
|
| 132 |
return text, image
|
| 133 |
|
| 134 |
# Gradio Interface
|
|
|
|
| 112 |
{"role": "user", "content": prompt}
|
| 113 |
]
|
| 114 |
try:
|
| 115 |
+
result = client.workers.ai.run(
|
| 116 |
account_id=ACCOUNT_ID,
|
| 117 |
model=CHAT_MODEL,
|
| 118 |
messages=messages,
|
| 119 |
)
|
| 120 |
|
| 121 |
+
print(f'response: {result["response"]}')
|
| 122 |
|
| 123 |
+
return result["response"]
|
| 124 |
|
| 125 |
except Exception as e:
|
| 126 |
raise gr.Error(str(e))
|
|
|
|
| 128 |
|
| 129 |
def gen(promtp: str, system_prompt: str):
|
| 130 |
text = generate_text(promtp, system_prompt)
|
| 131 |
+
image = generate_image(str(text))
|
| 132 |
return text, image
|
| 133 |
|
| 134 |
# Gradio Interface
|