KajetanNiewczas commited on
Commit
c14a77e
Β·
1 Parent(s): cfe97b3

New theme for the app and some descriptions

Browse files
gfx/long_logo.png ADDED

Git LFS Details

  • SHA256: 51fdbe2713564f222d57728adcafa9950fdce794f8af4eb149caabbffdd0d93a
  • Pointer size: 132 Bytes
  • Size of remote file: 1.07 MB
src/interface/gradio_interface.py CHANGED
@@ -3,6 +3,7 @@
3
  import gradio as gr
4
  from ..utils import upload_files
5
  from ..services import generate_presentation
 
6
 
7
 
8
  def upload_and_update_list(files, uploaded_list):
@@ -20,18 +21,61 @@ def generate_iframe(file_path):
20
  )
21
 
22
 
23
- with gr.Blocks() as demo:
24
- gr.Markdown("# πŸ“š RAGnTeX LaTeX Presentation Generator")
 
 
 
 
 
 
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  uploaded_files_state = gr.State([])
27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  with gr.Row():
29
  with gr.Column(scale=1):
30
  gr.Markdown("## πŸ“‚ Step 1: Upload PDF Documents")
31
  file_input = gr.File(
32
  file_types=[".pdf"], file_count="multiple", label="Select PDF Files"
33
  )
34
- upload_button = gr.Button("Upload Files")
35
 
36
  gr.Markdown("## 🎨 Step 2: Choose the presentation and color themes")
37
  presentation_theme_state = gr.State("default")
@@ -110,16 +154,16 @@ with gr.Blocks() as demo:
110
  placeholder="e.g., Introduction to Quantum Computing",
111
  lines=1,
112
  )
113
- submit_topic_button = gr.Button("Generate Outline")
114
 
115
  with gr.Column(scale=1):
116
- gr.Markdown("## πŸ“„ Uploaded Files (from State)")
117
  upload_output = gr.Textbox(
118
  label="Upload Status", lines=3, interactive=False
119
  )
120
 
121
- gr.Markdown("## πŸ“ Outline or Confirmation")
122
- topic_output = gr.Textbox(label="Topic Output", lines=6, interactive=False)
123
 
124
  gr.Markdown("## πŸŽ‰ Final Presentation")
125
  pdf_output = gr.File(label="Download/View Presentation")
 
3
  import gradio as gr
4
  from ..utils import upload_files
5
  from ..services import generate_presentation
6
+ import base64
7
 
8
 
9
  def upload_and_update_list(files, uploaded_list):
 
21
  )
22
 
23
 
24
+ theme = gr.themes.Monochrome(
25
+ neutral_hue=gr.themes.Color(c50="#f8f4fe", c100="#ede9fe", c200="#ddd6fe", c300="#c4b5fd",
26
+ c400="#a78bfa", c500="#8b5cf6", c600="#7c3aed", c700="#6d28d9",
27
+ c800="#5b21b6", c900="#4c1d95", c950="#181e44"),
28
+ ).set(
29
+ body_background_fill='*neutral_50',
30
+ body_text_color='*neutral_950'
31
+ )
32
 
33
+ js_func = """
34
+ function refresh() {
35
+ const url = new URL(window.location);
36
+
37
+ if (url.searchParams.get('__theme') !== 'light') {
38
+ url.searchParams.set('__theme', 'light');
39
+ window.location.href = url.href;
40
+ }
41
+ }
42
+ """
43
+
44
+ def encode_image(image_path):
45
+ with open(image_path, "rb") as f:
46
+ data = f.read()
47
+ return f"data:image/png;base64,{base64.b64encode(data).decode()}"
48
+
49
+ image_base64 = encode_image("gfx/long_logo.png")
50
+
51
+
52
+ with gr.Blocks(theme=theme,js=js_func) as demo:
53
  uploaded_files_state = gr.State([])
54
 
55
+ gr.Markdown("<h1 style=\"text-align:center;\">AI-powered LaTeX Presentation Generator</h1>")
56
+ with gr.Row():
57
+ with gr.Column(scale=1):
58
+ gr.HTML(f"""
59
+ <div style="text-align:center;">
60
+ <img src="{image_base64}" style="max-width: 100%; height: auto;" />
61
+ </div>
62
+ """)
63
+ with gr.Column(scale=1):
64
+ gr.Markdown("<div style=\"text-align:justify; margin-top: 15px;\">Turn your PDFs and ideas into beautiful LaTeX "
65
+ "presentations with AI. Built on top of the <a href=\"https://ragntex.github.io/lore/\">RAG\'n\'TeX</a>"
66
+ " engine, this tool automatically selects relevant content and compiles well-structured"
67
+ " slides. Ideal for students, researchers, and educators looking to save time and "
68
+ "create topic-focused presentations with minimal effort.</div>")
69
+ gr.Markdown("<div style=\"text-align:justify; margin-top: 0px;\">Just upload your PDFs, click <b>Upload Files</b>, "
70
+ "choose a theme, enter your topic, and hit <b>Generate Presentation</b> β€” it's that easy!</div>")
71
+
72
  with gr.Row():
73
  with gr.Column(scale=1):
74
  gr.Markdown("## πŸ“‚ Step 1: Upload PDF Documents")
75
  file_input = gr.File(
76
  file_types=[".pdf"], file_count="multiple", label="Select PDF Files"
77
  )
78
+ upload_button = gr.Button("Upload Files", variant="primary")
79
 
80
  gr.Markdown("## 🎨 Step 2: Choose the presentation and color themes")
81
  presentation_theme_state = gr.State("default")
 
154
  placeholder="e.g., Introduction to Quantum Computing",
155
  lines=1,
156
  )
157
+ submit_topic_button = gr.Button("Generate Presentation", variant="primary")
158
 
159
  with gr.Column(scale=1):
160
+ gr.Markdown("## πŸ“„ Uploaded Files")
161
  upload_output = gr.Textbox(
162
  label="Upload Status", lines=3, interactive=False
163
  )
164
 
165
+ gr.Markdown("## πŸ“ Presentation Processing")
166
+ topic_output = gr.Textbox(label="Compilation Status", lines=1, interactive=False)
167
 
168
  gr.Markdown("## πŸŽ‰ Final Presentation")
169
  pdf_output = gr.File(label="Download/View Presentation")