suryabbrj commited on
Commit
56ce111
1 Parent(s): 6e993f7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -24,17 +24,16 @@ def predict(image):
24
 
25
  sentiment_string = ''.join(str(e) for e in sentiment)
26
 
27
- formatted_cap = caption_string.replace("[{'generated_text': '" , "the image is of, ")
28
 
29
- formated_senti = sentiment_string.replace("{'label': ", ", The Tone of the image is mostly ")
30
 
31
- formated_senti = formated_senti.replace("score': ", " with approx : ")
32
 
33
- output = formatted_cap + formated_senti[1:-15] + '% score'
34
  return output
35
 
36
 
37
-
38
  input = gr.inputs.Image(
39
  label="Upload your Image and wait for 8-12 seconds!", type='pil', optional=False)
40
  output = gr.outputs.Textbox(label="Captions")
 
24
 
25
  sentiment_string = ''.join(str(e) for e in sentiment)
26
 
27
+ image_caption = caption_string[21:-3]
28
 
29
+ percentage =sentiment_string[34: -14]
30
 
31
+ tone = sentiment_string[11:-31]
32
 
33
+ output = 'the image is of, ' + image_caption + ", the overall tone of the image's content is - "+ tone + " with a approx "+ percentage + "% score"
34
  return output
35
 
36
 
 
37
  input = gr.inputs.Image(
38
  label="Upload your Image and wait for 8-12 seconds!", type='pil', optional=False)
39
  output = gr.outputs.Textbox(label="Captions")