Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -73,15 +73,14 @@ def run_gpt(
|
|
| 73 |
resp = ""
|
| 74 |
for response in stream:
|
| 75 |
resp += response.token.text
|
| 76 |
-
|
|
|
|
|
|
|
| 77 |
|
| 78 |
|
| 79 |
def run(purpose,history,model_drop):
|
| 80 |
print (history)
|
| 81 |
-
#print(purpose)
|
| 82 |
-
#print(hist)
|
| 83 |
task=None
|
| 84 |
-
directory="./"
|
| 85 |
#if history:
|
| 86 |
# history=str(history).strip("[]")
|
| 87 |
#if not history:
|
|
@@ -89,7 +88,8 @@ def run(purpose,history,model_drop):
|
|
| 89 |
|
| 90 |
#action_name, action_input = parse_action(line)
|
| 91 |
out_prompt = run_gpt(purpose,history)
|
| 92 |
-
yield ([(purpose,out_prompt)],None)
|
|
|
|
| 93 |
#out_img = infer(out_prompt)
|
| 94 |
model=loaded_model[int(model_drop)]
|
| 95 |
out_img=model(out_prompt)
|
|
@@ -102,7 +102,8 @@ def run(purpose,history,model_drop):
|
|
| 102 |
r = requests.get(url, stream=True)
|
| 103 |
if r.status_code == 200:
|
| 104 |
out = Image.open(io.BytesIO(r.content))
|
| 105 |
-
yield ([(purpose,out_prompt)],out)
|
|
|
|
| 106 |
else:
|
| 107 |
yield ([(purpose,"an Error occured")],None)
|
| 108 |
|
|
|
|
| 73 |
resp = ""
|
| 74 |
for response in stream:
|
| 75 |
resp += response.token.text
|
| 76 |
+
|
| 77 |
+
history.append((in_prompt,resp))
|
| 78 |
+
return history
|
| 79 |
|
| 80 |
|
| 81 |
def run(purpose,history,model_drop):
|
| 82 |
print (history)
|
|
|
|
|
|
|
| 83 |
task=None
|
|
|
|
| 84 |
#if history:
|
| 85 |
# history=str(history).strip("[]")
|
| 86 |
#if not history:
|
|
|
|
| 88 |
|
| 89 |
#action_name, action_input = parse_action(line)
|
| 90 |
out_prompt = run_gpt(purpose,history)
|
| 91 |
+
#yield ([(purpose,out_prompt)],None)
|
| 92 |
+
yield (out_prompt,None)
|
| 93 |
#out_img = infer(out_prompt)
|
| 94 |
model=loaded_model[int(model_drop)]
|
| 95 |
out_img=model(out_prompt)
|
|
|
|
| 102 |
r = requests.get(url, stream=True)
|
| 103 |
if r.status_code == 200:
|
| 104 |
out = Image.open(io.BytesIO(r.content))
|
| 105 |
+
#yield ([(purpose,out_prompt)],out)
|
| 106 |
+
yield (out_prompt,out)
|
| 107 |
else:
|
| 108 |
yield ([(purpose,"an Error occured")],None)
|
| 109 |
|