Zatimm commited on
Commit
125c359
·
verified ·
1 Parent(s): b35c516

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -49,7 +49,7 @@ def process_single_image(image: Image.Image) -> str:
49
  sequence = processor.batch_decode(outputs, skip_special_tokens=True)
50
  sequence = processor.post_process_generation(sequence, fix_markdown=False)
51
 
52
- return sequence
53
  except Exception as e:
54
  return f"Görüntü işlenirken bir hata oluştu: {e}"
55
 
@@ -58,8 +58,10 @@ def process_pdf_file(pdf_file) -> str:
58
  if not MODEL_LOADED or pdf_file is None:
59
  return "Model yüklenemedi veya PDF dosyası yüklenmedi."
60
 
 
61
  full_markdown_content =
62
  try:
 
63
  doc = fitz.open(stream=pdf_file.read(), filetype="pdf")
64
 
65
  for page_num in range(len(doc)):
@@ -121,6 +123,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
121
  api_name="process_image"
122
  )
123
 
 
124
  gr.Examples(
125
  examples=["nougat_paper_example.png"],
126
  inputs=image_input,
 
49
  sequence = processor.batch_decode(outputs, skip_special_tokens=True)
50
  sequence = processor.post_process_generation(sequence, fix_markdown=False)
51
 
52
+ return "".join(sequence)
53
  except Exception as e:
54
  return f"Görüntü işlenirken bir hata oluştu: {e}"
55
 
 
58
  if not MODEL_LOADED or pdf_file is None:
59
  return "Model yüklenemedi veya PDF dosyası yüklenmedi."
60
 
61
+ # HATA DÜZELTMESİ: Değişken boş bir liste olarak başlatıldı.
62
  full_markdown_content =
63
  try:
64
+ # Gelen dosya nesnesinden PDF'i oku
65
  doc = fitz.open(stream=pdf_file.read(), filetype="pdf")
66
 
67
  for page_num in range(len(doc)):
 
123
  api_name="process_image"
124
  )
125
 
126
+ gr.Markdown("### Örnek Kullanım")
127
  gr.Examples(
128
  examples=["nougat_paper_example.png"],
129
  inputs=image_input,