Spaces:
Runtime error
Runtime error
kpkishankrishna commited on
Commit ·
81ee8c5
1
Parent(s): f2b39bf
First upload
Browse files- Quintessential-Regular.ttf +0 -0
- app.py +23 -0
- bean_youtube_exam.JPG +0 -0
- distantlights1fb.jpg +0 -0
- requirements.txt +2 -0
Quintessential-Regular.ttf
ADDED
|
Binary file (73.9 kB). View file
|
|
|
app.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import PIL
|
| 3 |
+
from PIL import Image
|
| 4 |
+
from PIL import ImageDraw
|
| 5 |
+
from PIL import ImageFont
|
| 6 |
+
def predict(image, text,x_cor, y_cor, font_size, font_color, align, line_spacing):
|
| 7 |
+
# img = Image.open('/content/bean_youtube_exam.JPG')
|
| 8 |
+
img = Image.fromarray(image)
|
| 9 |
+
I1 = ImageDraw.Draw(img)
|
| 10 |
+
f_size = int(font_size)
|
| 11 |
+
myFont = ImageFont.truetype('Quintessential-Regular.ttf', f_size)
|
| 12 |
+
# if font_color[0] == "(":
|
| 13 |
+
# font_color = tuple(font_color)
|
| 14 |
+
I1.multiline_text((int(x_cor), int(y_cor)), text, font=myFont, fill =ast.literal_eval(font_color), spacing = line_spacing, align = align)
|
| 15 |
+
|
| 16 |
+
return img
|
| 17 |
+
intr = gr.Interface(predict, ["image", gr.Textbox(value="Is AI the Future of Fraud? \nFind out how ChatGPT Could Help You MAKE Fraud!", lines=10),
|
| 18 |
+
gr.Number(value=10), gr.Number(value=10), gr.Number(value=50),
|
| 19 |
+
gr.Textbox(value="white"), gr.Textbox(value="left"), gr.Number(value=50)],
|
| 20 |
+
"image", title = "Next word predictor",debug=True, description = "Press or delete an extra space so the model will compute for current input."
|
| 21 |
+
,examples=[["bean_youtube_exam.JPG", "Is AI the Future of Fraud? \nFind out how ChatGPT Could Help You MAKE Fraud!",10, 10, 30, "white", "left", 20],
|
| 22 |
+
["distantlights1fb.jpg","Is AI the Future of Fraud? \nFind out how ChatGPT Could Help You MAKE Fraud!",10, 10, 50, "(255,200,100)", "left", 20 ]])
|
| 23 |
+
intr.launch(inline = False)
|
bean_youtube_exam.JPG
ADDED
|
|
distantlights1fb.jpg
ADDED
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
PIL
|
| 2 |
+
gradio
|