Raghavan1988 commited on
Commit
e96a163
1 Parent(s): 937467a

only arxiv

Browse files
Files changed (1) hide show
  1. app.py +9 -7
app.py CHANGED
@@ -2,6 +2,8 @@ import json
2
  import os
3
  import shutil
4
  import requests
 
 
5
 
6
  import gradio as gr
7
  from huggingface_hub import Repository, InferenceClient
@@ -12,13 +14,7 @@ BOT_NAME = "Falcon"
12
 
13
  STOP_SEQUENCES = ["\nUser:", "<|endoftext|>", " User:", "###"]
14
 
15
- EXAMPLES = [
16
- ["Hey Falcon! Any recommendations for my holidays in Abu Dhabi?"],
17
- ["What's the Everett interpretation of quantum mechanics?"],
18
- ["Give me a list of the top 10 dive sites you would recommend around the world."],
19
- ["Can you tell me more about deep-water soloing?"],
20
- ["Can you write a short tweet about the release of our latest AI model, Falcon LLM?"]
21
- ]
22
 
23
  client = InferenceClient(
24
  API_URL,
@@ -57,6 +53,12 @@ def generate(
57
  seed=seed,
58
  )
59
  seed = seed + 1
 
 
 
 
 
 
60
  formatted_prompt = format_prompt(prompt, history, system_prompt)
61
 
62
  stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=True)
 
2
  import os
3
  import shutil
4
  import requests
5
+ import langchain
6
+ from langchain.document_loaders import ArxivLoader
7
 
8
  import gradio as gr
9
  from huggingface_hub import Repository, InferenceClient
 
14
 
15
  STOP_SEQUENCES = ["\nUser:", "<|endoftext|>", " User:", "###"]
16
 
17
+ EXAMPLES = ['2309.11495', '2306.01116']
 
 
 
 
 
 
18
 
19
  client = InferenceClient(
20
  API_URL,
 
53
  seed=seed,
54
  )
55
  seed = seed + 1
56
+
57
+ arxiv_key = prompt.strip().split(".")
58
+ if len(arxiv_key) != 2:
59
+ output = "Please enter a valid arXiv ID."
60
+ return output
61
+
62
  formatted_prompt = format_prompt(prompt, history, system_prompt)
63
 
64
  stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=True)