Spaces:
Runtime error
Runtime error
ChenyuRabbitLove
commited on
Commit
·
abab449
1
Parent(s):
4e52950
feat:change search transcript content api return format
Browse files- app.py +1 -1
- utils/utils.py +13 -2
app.py
CHANGED
@@ -134,4 +134,4 @@ with gr.Blocks() as demo:
|
|
134 |
|
135 |
|
136 |
if __name__ == "__main__":
|
137 |
-
demo.launch()
|
|
|
134 |
|
135 |
|
136 |
if __name__ == "__main__":
|
137 |
+
demo.launch()
|
utils/utils.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import os
|
|
|
2 |
|
3 |
import openai
|
4 |
import pandas as pd
|
@@ -60,6 +61,16 @@ def search_transcript_content(transcript_id, user_question):
|
|
60 |
by="distance", ascending=True
|
61 |
)
|
62 |
if transcript_db["distance"].values[0] > 0.2:
|
63 |
-
|
|
|
|
|
|
|
|
|
64 |
|
65 |
-
return transcript_db
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import os
|
2 |
+
import json
|
3 |
|
4 |
import openai
|
5 |
import pandas as pd
|
|
|
61 |
by="distance", ascending=True
|
62 |
)
|
63 |
if transcript_db["distance"].values[0] > 0.2:
|
64 |
+
result = {
|
65 |
+
"success": False,
|
66 |
+
"result": None
|
67 |
+
}
|
68 |
+
return json.dumps(result)
|
69 |
|
70 |
+
# return transcript_db["text"] in json format
|
71 |
+
result = {
|
72 |
+
"success": True,
|
73 |
+
"result": [text for text in transcript_db["text"].values]
|
74 |
+
}
|
75 |
+
|
76 |
+
return json.dumps(result)
|