Sebbe33 commited on
Commit
ec51c24
·
verified ·
1 Parent(s): ad8111f

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -32,7 +32,7 @@ def fetch_arxiv_summary(query, sort_by="relevance", sort_order="descending", max
32
  summaries.append(f"Titel: {title.text.strip()}\nLink: {link.text.strip()}\nZusammenfassung: {summary.text.strip()}")
33
  return summaries if summaries else ["Keine relevanten Studien gefunden."]
34
  except Exception as e:
35
- return [f"Fehler beim Abrufen der Studie: {str(e)}"]
36
 
37
  # Chatbot-Logik mit arXiv-Integration
38
  def respond(
@@ -52,7 +52,7 @@ def respond(
52
  study_info = "\n".join(study_summaries)
53
 
54
  # Nachrichten vorbereiten
55
- messages = [{"role": "system", "content": f"{system_message}\n"}]
56
  for val in history:
57
  if val[0]:
58
  messages.append({"role": "user", "content": val[0]})
@@ -84,7 +84,7 @@ def create_intro_text():
84
  demo = gr.ChatInterface(
85
  respond,
86
  additional_inputs=[
87
- gr.Textbox(value="You are a highly capable assistant specializing in parsing and summarizing study abstracts. Your task is to analyze the provided study data, extract relevant information, and offer concise summaries. Always include the study's title and a direct link, ensuring clarity and accessibility.", label="System message"),
88
  gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
89
  gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
90
  gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)"),
 
32
  summaries.append(f"Titel: {title.text.strip()}\nLink: {link.text.strip()}\nZusammenfassung: {summary.text.strip()}")
33
  return summaries if summaries else ["Keine relevanten Studien gefunden."]
34
  except Exception as e:
35
+ return [f"Fehler beim Abrufen der Studie: {str(e),str(url)}"]
36
 
37
  # Chatbot-Logik mit arXiv-Integration
38
  def respond(
 
52
  study_info = "\n".join(study_summaries)
53
 
54
  # Nachrichten vorbereiten
55
+ messages = [{"role": "system", "content": f"{system_message} You are a highly capable assistant specializing in parsing and summarizing study abstracts. Your task is to analyze the provided study data, extract relevant information, and offer concise summaries. Always include the study's title and a direct link, ensuring clarity and accessibility.\n"}]
56
  for val in history:
57
  if val[0]:
58
  messages.append({"role": "user", "content": val[0]})
 
84
  demo = gr.ChatInterface(
85
  respond,
86
  additional_inputs=[
87
+ gr.Textbox(value="You are helpful.", label="System message"),
88
  gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
89
  gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
90
  gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)"),