Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
import torch
|
| 2 |
import numpy as np
|
| 3 |
from PIL import Image
|
|
@@ -32,7 +33,7 @@ def generate_paragraph(caption):
|
|
| 32 |
|
| 33 |
# Decode the generated output
|
| 34 |
generated_text = tokenizer_2.decode(output[0], skip_special_tokens=True)
|
| 35 |
-
return generated_text
|
| 36 |
|
| 37 |
# create the Streamlit app
|
| 38 |
def app():
|
|
@@ -52,8 +53,6 @@ def app():
|
|
| 52 |
string = generate_captions(uploaded_file)
|
| 53 |
|
| 54 |
st.image(image, caption='The Uploaded File')
|
| 55 |
-
st.write("First is first captions for your Photo : ", string)
|
| 56 |
-
|
| 57 |
generated_paragraph = generate_paragraph(string)
|
| 58 |
|
| 59 |
st.write(generated_paragraph)
|
|
|
|
| 1 |
+
#import all necessary libraries
|
| 2 |
import torch
|
| 3 |
import numpy as np
|
| 4 |
from PIL import Image
|
|
|
|
| 33 |
|
| 34 |
# Decode the generated output
|
| 35 |
generated_text = tokenizer_2.decode(output[0], skip_special_tokens=True)
|
| 36 |
+
return generated_text.capitalize()
|
| 37 |
|
| 38 |
# create the Streamlit app
|
| 39 |
def app():
|
|
|
|
| 53 |
string = generate_captions(uploaded_file)
|
| 54 |
|
| 55 |
st.image(image, caption='The Uploaded File')
|
|
|
|
|
|
|
| 56 |
generated_paragraph = generate_paragraph(string)
|
| 57 |
|
| 58 |
st.write(generated_paragraph)
|