jedick commited on
Commit
c313a1f
·
1 Parent(s): 7879fc7

Update Gradio version

Browse files
Files changed (2) hide show
  1. README.md +1 -1
  2. app.py +34 -37
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: 🏢
4
  colorFrom: yellow
5
  colorTo: green
6
  sdk: gradio
7
- sdk_version: 5.32.0
8
  app_file: app.py
9
  pinned: false
10
  license: mit
 
4
  colorFrom: yellow
5
  colorTo: green
6
  sdk: gradio
7
+ sdk_version: 6.2.0
8
  app_file: app.py
9
  pinned: false
10
  license: mit
app.py CHANGED
@@ -50,29 +50,30 @@ if gr.NO_RELOAD:
50
  )
51
 
52
 
53
- # Setup theme without background image
54
- my_theme = gr.Theme.from_hub("NoCrypt/miku")
55
- my_theme.set(body_background_fill="#FFFFFF", body_background_fill_dark="#000000")
56
-
57
- # Define the HTML for Font Awesome
58
- font_awesome_html = '<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" rel="stylesheet">'
59
-
60
  # Gradio interface setup
61
- with gr.Blocks(theme=my_theme, head=font_awesome_html) as demo:
62
 
63
  # Layout
64
  with gr.Row():
65
  with gr.Column(scale=3):
66
  with gr.Row():
67
- gr.Markdown("# AI4citations")
68
- gr.Markdown(
69
- "## *AI-powered citation verification* ([more info](https://github.com/jedick/AI4citations))"
70
- )
71
- claim = gr.Textbox(
72
- label="Claim",
73
- info="aka hypothesis",
74
- placeholder="Input claim",
75
- )
 
 
 
 
 
 
 
 
76
  with gr.Row():
77
  with gr.Column(scale=2):
78
  with gr.Accordion("Get Evidence from PDF"):
@@ -86,7 +87,6 @@ with gr.Blocks(theme=my_theme, head=font_awesome_html) as demo:
86
  label="Retrieval Method",
87
  info="Keyword search (BM25S) or AI (DeBERTa, GPT)",
88
  )
89
- get_evidence = gr.Button(value="Get Evidence")
90
  top_k = gr.Slider(
91
  1,
92
  10,
@@ -94,40 +94,28 @@ with gr.Blocks(theme=my_theme, head=font_awesome_html) as demo:
94
  step=1,
95
  label="Top k sentences",
96
  )
 
97
  with gr.Column(scale=3):
98
  evidence = gr.TextArea(
99
  label="Evidence",
100
  info="aka premise",
101
- placeholder="Input evidence or use Get Evidence from PDF",
102
  )
103
  with gr.Row():
104
  prompt_tokens = gr.Number(label="Prompt tokens", visible=False)
105
  completion_tokens = gr.Number(
106
  label="Completion tokens", visible=False
107
  )
108
- gr.Markdown(
109
- """
110
- ### App Usage:
111
-
112
- - Input a **Claim**, then:
113
- - Upload a PDF and click **Get Evidence** OR
114
- - Input **Evidence** statements yourself
115
- - Make the **Prediction**:
116
- - Hit 'Enter' in the **Claim** text box OR
117
- - Hit 'Shift-Enter' in the **Evidence** text box OR
118
- - Click **Get Evidence**
119
- """
120
- )
121
- with gr.Accordion("Sources", open=False):
122
  gr.Markdown(
123
  """
124
- #### *Capstone project*
125
  - <i class="fa-brands fa-github"></i> [jedick/MLE-capstone-project](https://github.com/jedick/MLE-capstone-project) (project repo)
126
  - <i class="fa-brands fa-github"></i> [jedick/AI4citations](https://github.com/jedick/AI4citations) (app repo)
127
- #### *Text Classification*
128
  - <img src="https://huggingface.co/datasets/huggingface/brand-assets/resolve/main/hf-logo.svg" style="height: 1.2em; display: inline-block;"> [jedick/DeBERTa-v3-base-mnli-fever-anli-scifact-citint](https://huggingface.co/jedick/DeBERTa-v3-base-mnli-fever-anli-scifact-citint) (fine-tuned)
129
  - <img src="https://huggingface.co/datasets/huggingface/brand-assets/resolve/main/hf-logo.svg" style="height: 1.2em; display: inline-block;"> [MoritzLaurer/DeBERTa-v3-base-mnli-fever-anli](https://huggingface.co/MoritzLaurer/DeBERTa-v3-base-mnli-fever-anli) (base)
130
- #### *Evidence Retrieval*
131
  - <i class="fa-brands fa-github"></i> [xhluca/bm25s](https://github.com/xhluca/bm25s) (BM25S)
132
  - <img src="https://huggingface.co/datasets/huggingface/brand-assets/resolve/main/hf-logo.svg" style="height: 1.2em; display: inline-block;"> [deepset/deberta-v3-large-squad2](https://huggingface.co/deepset/deberta-v3-large-squad2) (DeBERTa)
133
  - <img src="https://upload.wikimedia.org/wikipedia/commons/4/4d/OpenAI_Logo.svg" style="height: 1.2em; display: inline-block;"> [gpt-4o-mini-2024-07-18](https://platform.openai.com/docs/pricing) (GPT)
@@ -493,4 +481,13 @@ with gr.Blocks(theme=my_theme, head=font_awesome_html) as demo:
493
 
494
  if __name__ == "__main__":
495
  # allowed_paths is needed to upload PDFs from specific example directory
496
- demo.launch(allowed_paths=[f"{os.getcwd()}/examples/retrieval"])
 
 
 
 
 
 
 
 
 
 
50
  )
51
 
52
 
 
 
 
 
 
 
 
53
  # Gradio interface setup
54
+ with gr.Blocks() as demo:
55
 
56
  # Layout
57
  with gr.Row():
58
  with gr.Column(scale=3):
59
  with gr.Row():
60
+ with gr.Column(scale=2):
61
+ gr.Markdown(
62
+ """
63
+ # AI4citations: AI-powered citation verification
64
+ 1. Input a **Claim**
65
+ 2. **Upload a PDF** or input **Evidence**
66
+ 3. Make the prediction:
67
+ - Click **Get Evidence and Submit** (with PDF)
68
+ - Or press **Shift-Enter** in any text box
69
+ """
70
+ )
71
+ with gr.Column(scale=3):
72
+ claim = gr.TextArea(
73
+ label="Claim",
74
+ info="aka hypothesis",
75
+ placeholder="1. Input a claim",
76
+ )
77
  with gr.Row():
78
  with gr.Column(scale=2):
79
  with gr.Accordion("Get Evidence from PDF"):
 
87
  label="Retrieval Method",
88
  info="Keyword search (BM25S) or AI (DeBERTa, GPT)",
89
  )
 
90
  top_k = gr.Slider(
91
  1,
92
  10,
 
94
  step=1,
95
  label="Top k sentences",
96
  )
97
+ get_evidence = gr.Button(value="Get Evidence and Submit")
98
  with gr.Column(scale=3):
99
  evidence = gr.TextArea(
100
  label="Evidence",
101
  info="aka premise",
102
+ placeholder="2. Input evidence or use Get Evidence from PDF",
103
  )
104
  with gr.Row():
105
  prompt_tokens = gr.Number(label="Prompt tokens", visible=False)
106
  completion_tokens = gr.Number(
107
  label="Completion tokens", visible=False
108
  )
109
+ with gr.Accordion("More info", open=True):
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  gr.Markdown(
111
  """
112
+ #### *MLE capstone project*
113
  - <i class="fa-brands fa-github"></i> [jedick/MLE-capstone-project](https://github.com/jedick/MLE-capstone-project) (project repo)
114
  - <i class="fa-brands fa-github"></i> [jedick/AI4citations](https://github.com/jedick/AI4citations) (app repo)
115
+ #### *Text classification*
116
  - <img src="https://huggingface.co/datasets/huggingface/brand-assets/resolve/main/hf-logo.svg" style="height: 1.2em; display: inline-block;"> [jedick/DeBERTa-v3-base-mnli-fever-anli-scifact-citint](https://huggingface.co/jedick/DeBERTa-v3-base-mnli-fever-anli-scifact-citint) (fine-tuned)
117
  - <img src="https://huggingface.co/datasets/huggingface/brand-assets/resolve/main/hf-logo.svg" style="height: 1.2em; display: inline-block;"> [MoritzLaurer/DeBERTa-v3-base-mnli-fever-anli](https://huggingface.co/MoritzLaurer/DeBERTa-v3-base-mnli-fever-anli) (base)
118
+ #### *Evidence retrieval*
119
  - <i class="fa-brands fa-github"></i> [xhluca/bm25s](https://github.com/xhluca/bm25s) (BM25S)
120
  - <img src="https://huggingface.co/datasets/huggingface/brand-assets/resolve/main/hf-logo.svg" style="height: 1.2em; display: inline-block;"> [deepset/deberta-v3-large-squad2](https://huggingface.co/deepset/deberta-v3-large-squad2) (DeBERTa)
121
  - <img src="https://upload.wikimedia.org/wikipedia/commons/4/4d/OpenAI_Logo.svg" style="height: 1.2em; display: inline-block;"> [gpt-4o-mini-2024-07-18](https://platform.openai.com/docs/pricing) (GPT)
 
481
 
482
  if __name__ == "__main__":
483
  # allowed_paths is needed to upload PDFs from specific example directory
484
+ allowed_paths=[f"{os.getcwd()}/examples/retrieval"]
485
+
486
+ # Setup theme without background image
487
+ theme = gr.Theme.from_hub("NoCrypt/miku")
488
+ theme.set(body_background_fill="#FFFFFF", body_background_fill_dark="#000000")
489
+
490
+ # Define the HTML for Font Awesome
491
+ head = '<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" rel="stylesheet">'
492
+
493
+ demo.launch(allowed_paths=allowed_paths, theme=theme, head=head)