Sebbe33 commited on
Commit
b972b5c
·
verified ·
1 Parent(s): f3fa4d5

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -34,12 +34,10 @@ def respond(
34
  message,
35
  history: list[tuple[str, str]],
36
  system_message,
37
- max_tokens,
38
- temperature,
39
- top_p,
40
  sort_by,
41
  sort_order,
42
  max_results,
 
43
  ):
44
  # Query generieren und Studien abrufen
45
  study_summaries = fetch_arxiv_summary(query, sort_by, sort_order, max_results)
@@ -59,10 +57,7 @@ def respond(
59
  response = ""
60
  for message in client.chat_completion(
61
  messages,
62
- max_tokens=max_tokens,
63
- stream=True,
64
- temperature=temperature,
65
- top_p=top_p,
66
  ):
67
  token = message.choices[0].delta.content
68
  response += token
@@ -76,9 +71,14 @@ with gr.Blocks() as demo:
76
  Enter your specific query in the field below, and the bot will provide you with studies including the title, link, and summary.
77
  """)
78
  query_input = gr.Textbox(value="", label="Query", placeholder="Enter your specific search term.")
 
 
 
 
79
  chat_interface = gr.ChatInterface(
80
- respond,
81
  additional_inputs=[
 
82
  gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
83
  gr.Dropdown(label="Sortby", choices=["relevance", "lastUpdatedDate", "submittedDate"], value="relevance"),
84
  gr.Dropdown(label="Sort", choices=["ascending", "descending"], value="descending"),
 
34
  message,
35
  history: list[tuple[str, str]],
36
  system_message,
 
 
 
37
  sort_by,
38
  sort_order,
39
  max_results,
40
+ query
41
  ):
42
  # Query generieren und Studien abrufen
43
  study_summaries = fetch_arxiv_summary(query, sort_by, sort_order, max_results)
 
57
  response = ""
58
  for message in client.chat_completion(
59
  messages,
60
+ stream=True
 
 
 
61
  ):
62
  token = message.choices[0].delta.content
63
  response += token
 
71
  Enter your specific query in the field below, and the bot will provide you with studies including the title, link, and summary.
72
  """)
73
  query_input = gr.Textbox(value="", label="Query", placeholder="Enter your specific search term.")
74
+
75
+ def respond_with_query(query, *args):
76
+ return respond(*args, query=query)
77
+
78
  chat_interface = gr.ChatInterface(
79
+ fn=respond_with_query,
80
  additional_inputs=[
81
+ query_input,
82
  gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
83
  gr.Dropdown(label="Sortby", choices=["relevance", "lastUpdatedDate", "submittedDate"], value="relevance"),
84
  gr.Dropdown(label="Sort", choices=["ascending", "descending"], value="descending"),