File size: 1,309 Bytes
1f94837
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d7fb4ec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import gradio as gr

def marks_percent(name, phy, che, mat):
  percent = (phy+che+mat)/3
  #res_emoji = "😍" if percent > 80 elif "πŸ™‚" percent > 40 and percent<80  else "😭"
  res_emoji = "😍" if percent > 80  else "😭"

  output_res = "Hello "+name+", Your Percentage is: "+str(percent)+"%"

  return (output_res ,res_emoji)



per_interface = gr.Interface(fn = marks_percent, 
                             inputs = ["text", gr.inputs.Slider(0,100, label = "Physics Marks"), 
                             gr.inputs.Slider(0,100, label = "Chemistry Marks"), 
                             gr.inputs.Slider(0,100, label = "Math Marks")],
                             outputs = ["text", "text"],
                             examples = [["Alex",79,95,98],
                                         ["Megan",99,98,100],
                                         ["Joe",75,67,58]],
                             #live=True,
                             flagging_options = ["Yes", "No", "Maybe"],
                             theme = "darkhuggingface",
                             #css = """
                             #body {background-color:purple}
                             #""",
                             title = "PCM Percentage"
                             )
per_interface.launch(inline=False)