Spaces:
Sleeping
Sleeping
tricktreat
commited on
Commit
•
bff5b69
1
Parent(s):
cad9141
url fixed
Browse files- app.py +6 -6
- awesome_chat.py +7 -2
app.py
CHANGED
@@ -98,20 +98,20 @@ class Client:
|
|
98 |
if not image_url.startswith("http"):
|
99 |
image_url = image_url.replace("public/", "")
|
100 |
messages = messages + [((None, (f"public/{image_url}",)))]
|
101 |
-
else:
|
102 |
-
|
103 |
for audio_url in audio_urls:
|
104 |
if not audio_url.startswith("http"):
|
105 |
audio_url = audio_url.replace("public/", "")
|
106 |
messages = messages + [((None, (f"public/{audio_url}",)))]
|
107 |
-
else:
|
108 |
-
|
109 |
for video_url in video_urls:
|
110 |
if not video_url.startswith("http"):
|
111 |
video_url = video_url.replace("public/", "")
|
112 |
messages = messages + [((None, (f"public/{video_url}",)))]
|
113 |
-
else:
|
114 |
-
|
115 |
return messages
|
116 |
|
117 |
with gr.Blocks() as demo:
|
|
|
98 |
if not image_url.startswith("http"):
|
99 |
image_url = image_url.replace("public/", "")
|
100 |
messages = messages + [((None, (f"public/{image_url}",)))]
|
101 |
+
# else:
|
102 |
+
# messages = messages + [((None, (f"{image_url}",)))]
|
103 |
for audio_url in audio_urls:
|
104 |
if not audio_url.startswith("http"):
|
105 |
audio_url = audio_url.replace("public/", "")
|
106 |
messages = messages + [((None, (f"public/{audio_url}",)))]
|
107 |
+
# else:
|
108 |
+
# messages = messages + [((None, (f"{audio_url}",)))]
|
109 |
for video_url in video_urls:
|
110 |
if not video_url.startswith("http"):
|
111 |
video_url = video_url.replace("public/", "")
|
112 |
messages = messages + [((None, (f"public/{video_url}",)))]
|
113 |
+
# else:
|
114 |
+
# messages = messages + [((None, (f"{video_url}",)))]
|
115 |
return messages
|
116 |
|
117 |
with gr.Blocks() as demo:
|
awesome_chat.py
CHANGED
@@ -839,10 +839,10 @@ def chat_huggingface(messages, openaikey = None, huggingfacetoken = None, return
|
|
839 |
logger.info(task_str)
|
840 |
|
841 |
if "error" in task_str:
|
842 |
-
return {"message": "
|
843 |
else:
|
844 |
task_str = task_str.strip()
|
845 |
-
|
846 |
if task_str == "[]": # using LLM response for empty task
|
847 |
record_case(success=False, **{"input": input, "task": [], "reason": "task parsing fail: empty", "op": "chitchat"})
|
848 |
response = chitchat(messages, openaikey)
|
@@ -873,6 +873,11 @@ def chat_huggingface(messages, openaikey = None, huggingfacetoken = None, return
|
|
873 |
for task in tasks:
|
874 |
dep = task["dep"]
|
875 |
# logger.debug(f"d.keys(): {d.keys()}, dep: {dep}")
|
|
|
|
|
|
|
|
|
|
|
876 |
if len(list(set(dep).intersection(d.keys()))) == len(dep) or dep[0] == -1:
|
877 |
tasks.remove(task)
|
878 |
thread = threading.Thread(target=run_task, args=(input, task, d, openaikey, huggingfacetoken))
|
|
|
839 |
logger.info(task_str)
|
840 |
|
841 |
if "error" in task_str:
|
842 |
+
return {"message": task_str["error"]["message"]}
|
843 |
else:
|
844 |
task_str = task_str.strip()
|
845 |
+
|
846 |
if task_str == "[]": # using LLM response for empty task
|
847 |
record_case(success=False, **{"input": input, "task": [], "reason": "task parsing fail: empty", "op": "chitchat"})
|
848 |
response = chitchat(messages, openaikey)
|
|
|
873 |
for task in tasks:
|
874 |
dep = task["dep"]
|
875 |
# logger.debug(f"d.keys(): {d.keys()}, dep: {dep}")
|
876 |
+
for dep_id in dep:
|
877 |
+
if dep_id >= task["id"]:
|
878 |
+
task["dep"] = [-1]
|
879 |
+
dep = [-1]
|
880 |
+
break
|
881 |
if len(list(set(dep).intersection(d.keys()))) == len(dep) or dep[0] == -1:
|
882 |
tasks.remove(task)
|
883 |
thread = threading.Thread(target=run_task, args=(input, task, d, openaikey, huggingfacetoken))
|