meriemm6 commited on
Commit
67c4888
·
verified ·
1 Parent(s): d85c6e8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +49 -8
app.py CHANGED
@@ -18,14 +18,55 @@ def classify_commit(message):
18
  # Return the predicted labels as a comma-separated string
19
  return ", ".join(predicted_labels[0]) if predicted_labels[0] else "No labels"
20
 
21
- # Create a Gradio interface
22
  demo = gr.Interface(
23
- fn=classify_commit, # Function to call
24
- inputs=gr.Textbox(label="Enter Commit Message"), # Input: Textbox for commit message
25
- outputs=gr.Textbox(label="Predicted Labels"), # Output: Textbox for predicted labels
26
- title="Commit Message Classifier",
27
- description="Enter a commit message to classify it into predefined categories."
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  )
29
 
30
- # Launch the Gradio app
31
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  # Return the predicted labels as a comma-separated string
19
  return ", ".join(predicted_labels[0]) if predicted_labels[0] else "No labels"
20
 
21
+ # Enhanced Gradio Interface
22
  demo = gr.Interface(
23
+ fn=classify_commit,
24
+ inputs=gr.Textbox(
25
+ label="Enter Commit Message",
26
+ placeholder="Type a commit message here...",
27
+ lines=3
28
+ ),
29
+ outputs=gr.Label(label="Predicted Categories"),
30
+ title="🚀 Commit Message Classifier",
31
+ description="📜 Enter a commit message to classify it into predefined categories.\n\n💡 **Example:** \"Fixed a bug in login feature\" → Predicted Categories: `bug fix`",
32
+ theme="default",
33
+ examples=[
34
+ "Fixed a bug in login feature",
35
+ "Added a new user dashboard",
36
+ "Updated order processing logic",
37
+ "Refactored payment module for better efficiency"
38
+ ],
39
+ live=True,
40
+ allow_flagging="never" # Disable flagging for a cleaner look
41
  )
42
 
43
+ # Add a custom background and layout
44
+ css = """
45
+ body {
46
+ font-family: 'Arial', sans-serif;
47
+ background-color: #f7f9fc;
48
+ margin: 0;
49
+ padding: 0;
50
+ }
51
+ #component-0 {
52
+ background-color: #ffffff;
53
+ border: 1px solid #ddd;
54
+ border-radius: 10px;
55
+ padding: 20px;
56
+ box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
57
+ }
58
+ textarea {
59
+ font-size: 16px;
60
+ border-radius: 5px;
61
+ border: 1px solid #ccc;
62
+ padding: 10px;
63
+ resize: none;
64
+ }
65
+ label {
66
+ font-weight: bold;
67
+ font-size: 18px;
68
+ }
69
+ """
70
+
71
+ # Launch the Gradio app with custom styling
72
+ demo.launch(share=True, server_port=7860, auth=("user", "password"), css=css)