sujataprakashdatycs commited on
Commit
47e2d4b
·
verified ·
1 Parent(s): 6ea834d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -271,18 +271,18 @@ def pdf_to_iframe(file):
271
  pdf_bytes = f.read()
272
  encoded = base64.b64encode(pdf_bytes).decode("utf-8")
273
  return f"""
274
- <div style="width:00%; max-width:100%;">
275
- <iframe
276
- src="data:application/pdf;base64,{encoded}"
277
- style="width:100%; height:600px; border:1px solid #ccc;"
278
- ></iframe>
279
- </div>
280
  """
281
  except Exception as e:
282
  return f"<p style='color:red;'>Failed to display PDF: {e}</p>"
283
 
284
 
285
 
 
286
  # ---------- Gradio UI ----------
287
  with gr.Blocks(theme=simple_theme, title=APP_TITLE) as interface:
288
  gr.HTML(f"""
 
271
  pdf_bytes = f.read()
272
  encoded = base64.b64encode(pdf_bytes).decode("utf-8")
273
  return f"""
274
+ <iframe
275
+ src="data:application/pdf;base64,{encoded}"
276
+ width="100%" height="80vh" <!-- dynamic height: 80% of viewport -->
277
+ style="border:1px solid #ccc;"
278
+ ></iframe>
 
279
  """
280
  except Exception as e:
281
  return f"<p style='color:red;'>Failed to display PDF: {e}</p>"
282
 
283
 
284
 
285
+
286
  # ---------- Gradio UI ----------
287
  with gr.Blocks(theme=simple_theme, title=APP_TITLE) as interface:
288
  gr.HTML(f"""