taesiri commited on
Commit
c5cc645
β€’
1 Parent(s): 76cda31

updated to graadio 4.0

Browse files
Files changed (2) hide show
  1. README.md +4 -4
  2. app.py +17 -12
README.md CHANGED
@@ -1,11 +1,11 @@
1
  ---
2
  title: Claude Reads Arxiv
3
  emoji: πŸ“–
4
- colorFrom: blue
5
- colorTo: red
6
  sdk: gradio
7
- sdk_version: 3.50.2
8
- app_file: start.py
9
  pinned: false
10
  license: apache-2.0
11
  ---
 
1
  ---
2
  title: Claude Reads Arxiv
3
  emoji: πŸ“–
4
+ colorFrom: red
5
+ colorTo: blue
6
  sdk: gradio
7
+ sdk_version: 4.4.1
8
+ app_file: app.py
9
  pinned: false
10
  license: apache-2.0
11
  ---
app.py CHANGED
@@ -8,26 +8,30 @@ import gradio as gr
8
  import requests
9
  from anthropic import AI_PROMPT, HUMAN_PROMPT, Anthropic
10
  from arxiv_latex_extractor import get_paper_content
11
- from fastapi.staticfiles import StaticFiles
12
  from huggingface_hub import HfApi
13
 
14
 
15
- from coreservice import app
16
-
17
-
18
  LEADING_PROMPT = "Read the following paper:"
19
 
20
- # with open("assets/custom.css", "r", encoding="utf-8") as f:
21
- # custom_css = f.read()
22
 
23
  custom_css = """
24
  div#component-4 #chatbot {
25
  height: 800px !important;
26
  }
27
 
28
- """
29
 
30
 
 
 
 
 
 
 
 
 
 
 
31
  def replace_texttt(text):
32
  return re.sub(r"\\texttt\{(.*?)\}", r"*\1*", text)
33
 
@@ -217,7 +221,7 @@ def clear_context():
217
 
218
 
219
  with gr.Blocks(
220
- theme=gr.themes.Soft(), css=custom_css, title="ArXiv QA with Claude"
221
  ) as demo:
222
  gr.HTML(
223
  """
@@ -248,8 +252,8 @@ with gr.Blocks(
248
  """
249
  )
250
 
251
- with gr.Row().style(equal_height=False):
252
- with gr.Column(scale=2, emem_id="column-flex"):
253
  chatbot = gr.Chatbot(
254
  elem_id="chatbot",
255
  avatar_images=("./assets/user.png", "./assets/Claude.png"),
@@ -293,6 +297,7 @@ with gr.Blocks(
293
 
294
  btn_clear.click(clear_context, outputs=[chatbot])
295
 
 
296
 
297
- app.mount("/js", StaticFiles(directory="js"), name="js")
298
- gr.mount_gradio_app(app, demo, path="/")
 
8
  import requests
9
  from anthropic import AI_PROMPT, HUMAN_PROMPT, Anthropic
10
  from arxiv_latex_extractor import get_paper_content
 
11
  from huggingface_hub import HfApi
12
 
13
 
 
 
 
14
  LEADING_PROMPT = "Read the following paper:"
15
 
 
 
16
 
17
  custom_css = """
18
  div#component-4 #chatbot {
19
  height: 800px !important;
20
  }
21
 
22
+ rowZ"""
23
 
24
 
25
+ ga_script = """
26
+ <script async src="https://www.googletagmanager.com/gtag/js?id=G-EZ77X5T529"></script>
27
+ <script>
28
+ window.dataLayer = window.dataLayer || [];
29
+ function gtag(){dataLayer.push(arguments);}
30
+ gtag('js', new Date());
31
+ gtag('config', 'G-EZ77X5T529');
32
+ </script>
33
+ """
34
+
35
  def replace_texttt(text):
36
  return re.sub(r"\\texttt\{(.*?)\}", r"*\1*", text)
37
 
 
221
 
222
 
223
  with gr.Blocks(
224
+ theme=gr.themes.Soft(), css=custom_css, title="ArXiv QA with Claude", head=ga_script
225
  ) as demo:
226
  gr.HTML(
227
  """
 
252
  """
253
  )
254
 
255
+ with gr.Row():
256
+ with gr.Column(scale=2):
257
  chatbot = gr.Chatbot(
258
  elem_id="chatbot",
259
  avatar_images=("./assets/user.png", "./assets/Claude.png"),
 
297
 
298
  btn_clear.click(clear_context, outputs=[chatbot])
299
 
300
+ demo.launch()
301
 
302
+ # app.mount("/js", StaticFiles(directory="js"), name="js")
303
+ # gr.mount_gradio_app(app, demo, path="/")