kartik91 commited on
Commit
6abc848
·
verified ·
1 Parent(s): 0d23717

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -11,7 +11,8 @@ repo_id = "mistralai/Mistral-7B-Instruct-v0.2"
11
  llm = HuggingFaceEndpoint(
12
  repo_id=repo_id,
13
  max_length=100,
14
- temperature=0.5
 
15
  )
16
  def reduce_add(a):
17
  ll=dict()
@@ -76,9 +77,12 @@ description = """
76
  Upload an image, and this app will generate a short story based on the image.
77
  """
78
 
79
- def sepia(input_img):
80
- sepia_img=chain.invoke(input_img)
81
- return sepia_img
 
 
 
82
 
83
  demo = gr.Interface(sepia, gr.Image(type='pil'), "textarea",title=title,
84
  description=description,live=True
 
11
  llm = HuggingFaceEndpoint(
12
  repo_id=repo_id,
13
  max_length=100,
14
+ temperature=0.5,
15
+ streaming=True
16
  )
17
  def reduce_add(a):
18
  ll=dict()
 
77
  Upload an image, and this app will generate a short story based on the image.
78
  """
79
 
80
+
81
+ async def sepia(input_img):
82
+ chunks=[]
83
+ async for e in chain.astream(input={"segmentation_results":input_img}):
84
+ chunks.append(e)
85
+ yield "".join(chunks)
86
 
87
  demo = gr.Interface(sepia, gr.Image(type='pil'), "textarea",title=title,
88
  description=description,live=True