shoom013 commited on
Commit
4202dae
·
verified ·
1 Parent(s): 76acc8f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -14
app.py CHANGED
@@ -126,14 +126,7 @@ def rag(input_text, history, jezik):
126
  query_engine = index2.as_query_engine()
127
  # return query_engine.query(input_text)
128
  # return history.append({"role": "assistant", "content": query_engine.query(input_text)})
129
- return [history.append(
130
- ChatMessage(role="user",
131
- content=input_text
132
- ).append(
133
- role="assistant",
134
- content=query_engine.query(input_text)
135
- )
136
- )]
137
  # collection.add(
138
  # documents=documents,
139
  # ids=[f"id{last+i}" for i in range(len(documents))],
@@ -160,11 +153,7 @@ def rag(input_text, history, jezik):
160
  # if (o_jezik!='N/A'):
161
  # input_text += " - odgovori " + o_jezik + "."
162
  # return query_engine.query(input_text)
163
- return [history.append(
164
- ChatMessage(role="assistant",
165
- content=chat_engine.chat(input_text)
166
- )
167
- )]
168
  # Interface
169
  # gr.Textbox(label="Pitanje:", lines=6),
170
  # outputs=[gr.Textbox(label="Odgovor:", lines=6)],
@@ -172,7 +161,7 @@ def rag(input_text, history, jezik):
172
  iface = gr.ChatInterface(rag,
173
  title="UChat",
174
  description="Postavite pitanje ili opišite problem koji imate",
175
- chatbot=gr.Chatbot(placeholder="Kako Vam mogu pomoći?", type="messages", label="UChat", height=300),
176
  textbox=gr.Textbox(placeholder="Pitanje ili opis problema", container=False, scale=7),
177
  theme="soft",
178
  # examples=["Ne radi mi internet", "Koje usluge imam na raspologanju?", "Ne radi mi daljinski upravljač, šta da radim?"],
 
126
  query_engine = index2.as_query_engine()
127
  # return query_engine.query(input_text)
128
  # return history.append({"role": "assistant", "content": query_engine.query(input_text)})
129
+ return [input_text query_engine.query(input_text)]
 
 
 
 
 
 
 
130
  # collection.add(
131
  # documents=documents,
132
  # ids=[f"id{last+i}" for i in range(len(documents))],
 
153
  # if (o_jezik!='N/A'):
154
  # input_text += " - odgovori " + o_jezik + "."
155
  # return query_engine.query(input_text)
156
+ return [input_text chat_engine.chat(input_text)]
 
 
 
 
157
  # Interface
158
  # gr.Textbox(label="Pitanje:", lines=6),
159
  # outputs=[gr.Textbox(label="Odgovor:", lines=6)],
 
161
  iface = gr.ChatInterface(rag,
162
  title="UChat",
163
  description="Postavite pitanje ili opišite problem koji imate",
164
+ chatbot=gr.Chatbot(placeholder="Kako Vam mogu pomoći?", type="tuples", label="UChat", height=300),
165
  textbox=gr.Textbox(placeholder="Pitanje ili opis problema", container=False, scale=7),
166
  theme="soft",
167
  # examples=["Ne radi mi internet", "Koje usluge imam na raspologanju?", "Ne radi mi daljinski upravljač, šta da radim?"],