handwritten_1 / app.py
kpkishankrishna
1
47e726b
import gradio as gr
import demo_1
from demo_1 import Hand
def predict(text, script):
hand = Hand()
lines = text.split('\n')
# print(lines)
# print(type(lines[0]))
# lines_1 = ["Hello Krishna",
# "This image is generated by local",
# "The one you found out the yesterday",
# "It is generated in my desktop"]
# print(type(lines_1[0]))
# print(lines_1)
biases = [.75 for i in lines]
styles = [9 for i in lines]
# stroke_colors = ['red', 'green', 'black', 'blue']
# stroke_widths = [1, 2, 1, 2]
a = hand.write(
script=script,
lines=lines,
# biases=biases,
# styles=styles,
# stroke_colors=stroke_colors,
# stroke_widths=stroke_widths
)
return f'video/{a}.mp4'
def run():
cali = gr.Interface(fn=predict, inputs=["text", "text"],
outputs="video")
cali.launch(server_name="0.0.0.0", server_port=7860)
if __name__ == "__main__":
run()