SWHL commited on
Commit
a0112f4
·
verified ·
1 Parent(s): 5864c3b

Upload app_gradio.py

Browse files
Files changed (1) hide show
  1. app_gradio.py +44 -0
app_gradio.py ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- encoding: utf-8 -*-
2
+ # @Author: SWHL
3
+ # @Contact: [email protected]
4
+ import gradio as gr
5
+
6
+
7
+ def welcome(name):
8
+ return f"Welcome to Gradio, {name}!"
9
+
10
+
11
+ title_content = """
12
+ # Rapid⚡OCR
13
+ <p align="center">
14
+ <a href=""><img src="https://img.shields.io/badge/Python->=3.6-aff.svg"></a>
15
+ <a href=""><img src="https://img.shields.io/badge/OS-Linux%2C%20Win%2C%20Mac-pink.svg"></a>
16
+ <a href="https://pepy.tech/project/rapidocr"><img src="https://static.pepy.tech/personalized-badge/rapidocr?period=total&units=abbreviation&left_color=grey&right_color=blue&left_text=Downloads%20Ort"></a>
17
+ <a href="https://pypi.org/project/rapidocr/"><img alt="PyPI" src="https://img.shields.io/pypi/v/rapidocr"></a>
18
+ </p>
19
+ """
20
+
21
+ custom_css = """
22
+ body {font-family: body {font-family: 'Helvetica Neue', Helvetica;}
23
+ .gr-button {background-color: #4CAF50; color: white; border: none; padding: 10px 20px; border-radius: 5px;}
24
+ .gr-button:hover {background-color: #45a049;}
25
+ .gr-textbox {margin-bottom: 15px;}
26
+ .example-button {background-color: #1E90FF; color: white; border: none; padding: 8px 15px; border-radius: 5px; margin: 5px;}
27
+ .example-button:hover {background-color: #FF4500;}
28
+ .tall-radio .gr-radio-item {padding: 15px 0; min-height: 50px; display: flex; align-items: center;}
29
+ .tall-radio label {font-size: 16px;}
30
+ """
31
+
32
+ with gr.Blocks(
33
+ title="Rapid⚡OCR Demo", css="custom_css", theme=gr.themes.Soft()
34
+ ) as demo:
35
+ gr.Markdown("<h1 style='text-align: center; color: #333;'>Rapid⚡OCR</h1>")
36
+ gr.Markdown(
37
+ '<span><a href=""><img src="https://img.shields.io/badge/Python->=3.6-aff.svg"></a><a href=""><img src="https://img.shields.io/badge/OS-Linux%2C%20Win%2C%20Mac-pink.svg"></a><a href="https://pepy.tech/project/rapidocr"><img src="https://static.pepy.tech/personalized-badge/rapidocr?period=total&units=abbreviation&left_color=grey&right_color=blue&left_text=Downloads%20Ort"></a><a href="https://pypi.org/project/rapidocr/"><img alt="PyPI" src="https://img.shields.io/pypi/v/rapidocr"></a></span>'
38
+ )
39
+ inp = gr.Textbox(placeholder="What is your name?")
40
+ out = gr.Textbox()
41
+ inp.change(welcome, inp, out)
42
+
43
+ if __name__ == "__main__":
44
+ demo.launch(debug=True)