Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -119,7 +119,8 @@ def rag(input_text, history, jezik, file):
|
|
119 |
documents = SimpleDirectoryReader(file.name).load_data()
|
120 |
index2 = VectorStoreIndex.from_documents(documents)
|
121 |
query_engine = index2.as_query_engine()
|
122 |
-
return query_engine.query(input_text)
|
|
|
123 |
# collection.add(
|
124 |
# documents=documents,
|
125 |
# ids=[f"id{last+i}" for i in range(len(documents))],
|
@@ -146,14 +147,14 @@ def rag(input_text, history, jezik, file):
|
|
146 |
# if (o_jezik!='N/A'):
|
147 |
# input_text += " - odgovori " + o_jezik + "."
|
148 |
# return query_engine.query(input_text)
|
149 |
-
return chat_engine.chat(input_text)
|
150 |
# Interface
|
151 |
# gr.Textbox(label="Pitanje:", lines=6),
|
152 |
# outputs=[gr.Textbox(label="Odgovor:", lines=6)],
|
153 |
iface = gr.ChatInterface(rag,
|
154 |
-
title="
|
155 |
description="Postavite pitanje ili opišite problem koji imate",
|
156 |
-
chatbot=gr.Chatbot(height=300),
|
157 |
textbox=gr.Textbox(placeholder="Pitanje ili opis problema", container=False, scale=7),
|
158 |
theme="soft",
|
159 |
# examples=["Ne radi mi internet", "Koje usluge imam na raspologanju?", "Ne radi mi daljinski upravljač, šta da radim?"],
|
|
|
119 |
documents = SimpleDirectoryReader(file.name).load_data()
|
120 |
index2 = VectorStoreIndex.from_documents(documents)
|
121 |
query_engine = index2.as_query_engine()
|
122 |
+
# return query_engine.query(input_text)
|
123 |
+
return history.append({"role": "assistant", "content": query_engine.query(input_text)})
|
124 |
# collection.add(
|
125 |
# documents=documents,
|
126 |
# ids=[f"id{last+i}" for i in range(len(documents))],
|
|
|
147 |
# if (o_jezik!='N/A'):
|
148 |
# input_text += " - odgovori " + o_jezik + "."
|
149 |
# return query_engine.query(input_text)
|
150 |
+
return history.append({"role": "assistant", "content": chat_engine.chat(input_text)})
|
151 |
# Interface
|
152 |
# gr.Textbox(label="Pitanje:", lines=6),
|
153 |
# outputs=[gr.Textbox(label="Odgovor:", lines=6)],
|
154 |
iface = gr.ChatInterface(rag,
|
155 |
+
title="UChat",
|
156 |
description="Postavite pitanje ili opišite problem koji imate",
|
157 |
+
chatbot=gr.Chatbot("Kako Vam mogu pomoći?", type='messages', label="Uchat", height=300),
|
158 |
textbox=gr.Textbox(placeholder="Pitanje ili opis problema", container=False, scale=7),
|
159 |
theme="soft",
|
160 |
# examples=["Ne radi mi internet", "Koje usluge imam na raspologanju?", "Ne radi mi daljinski upravljač, šta da radim?"],
|