Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
import gradio as gr
|
2 |
import requests
|
3 |
-
import json
|
4 |
import io
|
5 |
import random
|
6 |
import os
|
@@ -39,13 +38,12 @@ def extend_prompt(input_text):
|
|
39 |
response = requests.post(API_URL, headers=HEADERS, json=payload)
|
40 |
response.raise_for_status()
|
41 |
|
42 |
-
output = response.json()
|
43 |
-
|
44 |
-
extended_prompt = json.loads(output)[0]["generated_text"].strip()
|
45 |
-
return extended_prompt
|
46 |
|
47 |
except requests.exceptions.RequestException as e:
|
48 |
-
|
|
|
49 |
|
50 |
def generate_image(prompt, selected_model, is_negative=False, steps=1, cfg_scale=6, seed=None):
|
51 |
if not prompt.strip():
|
|
|
1 |
import gradio as gr
|
2 |
import requests
|
|
|
3 |
import io
|
4 |
import random
|
5 |
import os
|
|
|
38 |
response = requests.post(API_URL, headers=HEADERS, json=payload)
|
39 |
response.raise_for_status()
|
40 |
|
41 |
+
output = response.json()[0]
|
42 |
+
return output
|
|
|
|
|
43 |
|
44 |
except requests.exceptions.RequestException as e:
|
45 |
+
gr.Warning("Cannot extend prompt: Please try again.")
|
46 |
+
return input_text
|
47 |
|
48 |
def generate_image(prompt, selected_model, is_negative=False, steps=1, cfg_scale=6, seed=None):
|
49 |
if not prompt.strip():
|