Docfile commited on
Commit
5fedf9f
·
verified ·
1 Parent(s): 271a3d2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -1,12 +1,14 @@
1
- import pathlib
2
- import textwrap
3
  import gradio as gr
4
  import google.generativeai as genai
5
- from IPython.display import display, Markdown
 
6
 
7
  def to_markdown(text):
8
- text = text.replace('•', ' *')
9
- return Markdown(textwrap.indent(text, '> ', predicate=lambda _: True))
 
 
 
10
 
11
  token = "AIzaSyDYhyRoOWBJWOb4bqY5wmFLrBo4HTwQDko"
12
  genai.configure(api_key=token)
@@ -23,4 +25,4 @@ def generate_content(image):
23
 
24
  # Interface Gradio
25
  iface = gr.Interface(fn=generate_content, inputs=gr.Image(type='pil'), outputs="text")
26
- iface.launch()
 
 
 
1
  import gradio as gr
2
  import google.generativeai as genai
3
+ from IPython.display import Markdown
4
+ import textwrap
5
 
6
  def to_markdown(text):
7
+ if text is not None:
8
+ text = text.replace('•', ' *')
9
+ return Markdown(textwrap.indent(text, '> ', predicate=lambda _: True))
10
+ else:
11
+ return Markdown("No response received.")
12
 
13
  token = "AIzaSyDYhyRoOWBJWOb4bqY5wmFLrBo4HTwQDko"
14
  genai.configure(api_key=token)
 
25
 
26
  # Interface Gradio
27
  iface = gr.Interface(fn=generate_content, inputs=gr.Image(type='pil'), outputs="text")
28
+ iface.launch(share=True)