kgauvin603 commited on
Commit
805e964
·
verified ·
1 Parent(s): a4076e5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -27,16 +27,16 @@ user_prompt_template = (
27
  "author, but enhance readability and flow. Do not add embellishments or AI-style phrasing."
28
  )
29
 
30
- # === Encode uploaded file ===
31
  def encode_image_to_base64(file_bytes):
32
- return base64.b64encode(file_bytes()).decode("utf-8")
33
 
34
  # === Transcription logic ===
35
- def transcribe_image(file):
36
- if not file:
37
  return "No image uploaded."
38
 
39
- encoded = encode_image_to_base64(file)
40
  image_url = f"data:image/jpeg;base64,{encoded}"
41
 
42
  response = client.chat.completions.create(
@@ -63,4 +63,5 @@ with gr.Blocks() as app:
63
 
64
  # === Launch ===
65
  if __name__ == "__main__":
66
- app.launch(share=True)
 
 
27
  "author, but enhance readability and flow. Do not add embellishments or AI-style phrasing."
28
  )
29
 
30
+ # === Encode uploaded bytes ===
31
  def encode_image_to_base64(file_bytes):
32
+ return base64.b64encode(file_bytes).decode("utf-8")
33
 
34
  # === Transcription logic ===
35
+ def transcribe_image(file_bytes):
36
+ if not file_bytes:
37
  return "No image uploaded."
38
 
39
+ encoded = encode_image_to_base64(file_bytes)
40
  image_url = f"data:image/jpeg;base64,{encoded}"
41
 
42
  response = client.chat.completions.create(
 
63
 
64
  # === Launch ===
65
  if __name__ == "__main__":
66
+ app.launch()
67
+