meriemm6 commited on
Commit
170d9e9
Β·
verified Β·
1 Parent(s): 67c4888

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -42
app.py CHANGED
@@ -18,55 +18,26 @@ 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
- # 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)
 
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 with enhanced aesthetics
22
  demo = gr.Interface(
23
  fn=classify_commit,
24
  inputs=gr.Textbox(
25
  label="Enter Commit Message",
26
+ placeholder="Type your commit message here...",
27
+ lines=3,
28
+ max_lines=5,
29
  ),
30
+ outputs=gr.Textbox(label="Predicted Labels"),
31
  title="πŸš€ Commit Message Classifier",
32
+ description="πŸ“œ This tool classifies commit messages into categories like 'bug fix', 'feature addition', and more. Enter a message to see the predicted labels.",
 
33
  examples=[
34
+ ["Fixed a bug in the login feature"],
35
+ ["Added a new user dashboard"],
36
+ ["Updated order processing logic"],
37
+ ["Refactored the payment module for better performance"],
38
  ],
39
+ theme="compact", # Optional: A compact Gradio theme
 
40
  )
41
 
42
+ # Launch the Gradio app
43
+ demo.launch(share=True, server_port=7860)