Doubleupai commited on
Commit
e9f8029
·
verified ·
1 Parent(s): 2ac2e7b

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +72 -0
app.py ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ # Function to generate description from link (dummy implementation)
4
+ def generate_description(link):
5
+ # In a real-world scenario, you would use this function to process the link
6
+ # and generate a description. For this example, we'll just return a dummy description.
7
+ if "example.com" in link:
8
+ return "This is a description for example.com"
9
+ elif "google.com" in link:
10
+ return "This is a description for google.com"
11
+ else:
12
+ return "Description not available for this link."
13
+
14
+ # Custom CSS for styling
15
+ custom_css = """
16
+ body {
17
+ background-color: #f0f8ff;
18
+ font-family: 'Arial', sans-serif;
19
+ }
20
+ .gradio-container {
21
+ max-width: 600px;
22
+ margin: 0 auto;
23
+ padding: 20px;
24
+ border-radius: 10px;
25
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
26
+ }
27
+ .gradio-input, .gradio-output {
28
+ margin-bottom: 20px;
29
+ }
30
+ .gradio-input input[type="text"] {
31
+ width: 100%;
32
+ padding: 10px;
33
+ border: 1px solid #ccc;
34
+ border-radius: 5px;
35
+ }
36
+ .gradio-output textarea {
37
+ width: 100%;
38
+ padding: 10px;
39
+ border: 1px solid #ccc;
40
+ border-radius: 5px;
41
+ resize: none;
42
+ }
43
+ .gradio-button {
44
+ background-color: #4CAF50;
45
+ color: white;
46
+ padding: 10px 20px;
47
+ border: none;
48
+ border-radius: 5px;
49
+ cursor: pointer;
50
+ }
51
+ .gradio-button:hover {
52
+ background-color: #45a049;
53
+ }
54
+ """
55
+
56
+ # Create the Gradio interface with custom CSS
57
+ iface = gr.Interface(
58
+ fn=generate_description, # Function to call
59
+ inputs="text", # Input type: text (for the link)
60
+ outputs="text", # Output type: text (for the description)
61
+ title="Link to Description",
62
+ description="Enter a link to get a description.",
63
+ examples=[
64
+ ["https://www.example.com"],
65
+ ["https://www.google.com"],
66
+ ["https://www.github.com"]
67
+ ],
68
+ css=custom_css
69
+ )
70
+
71
+ # Launch the interface
72
+ iface.launch()