【发布时间】:2022-08-15 02:54:32
【问题描述】:
每当我单击按钮而不是显示框自动关闭的文本时,我都试图使用带有“电子邮件”按钮的文本输入来捕获文本
我已经尝试过,但不知道问题出在哪里,任何想法都将不胜感激
import streamlit as st #web app and camera
import numpy as np # for image processing
from PIL import Image #Image processing
import cv2 #computer vision
def dodgeV2(x, y):
return cv2.divide(x, 255 - y, scale=256)
def pencilsketch(inp_img):
img_gray = cv2.cvtColor(inp_img, cv2.COLOR_BGR2GRAY)
img_invert = cv2.bitwise_not(img_gray)
img_smoothing = cv2.GaussianBlur(img_invert, (21, 21),sigmaX=0, sigmaY=0)
final_img = dodgeV2(img_gray, img_smoothing)
return(final_img)
file_image = st.camera_input(label = \"Take a pic of you to be sketched out\")
if file_image:
input_img = Image.open(file_image)
final_sketch = pencilsketch(np.array(input_img))
st.write(\"**Output Pencil Sketch**\")
st.image(final_sketch, use_column_width=True)
if st.button(\"Download Sketch Images\"):
im_pil = Image.fromarray(final_sketch)
im_pil.save(\'final_image.jpeg\')
st.write(\'Download completed\')
#the issue code starts from here
if st.button(\"Email\"):
form = st.form(key=\'my-form\')
name = form.text_input(\'Enter your name\')
submit = form.form_submit_button(\'Submit\')
st.write(\'Press submit to have your name printed below\')
if submit:
st.write(f\'hello {name}\')
else:
st.write(\"You haven\'t uploaded any image file\")