TutorPal commited on
Commit
ccef8ca
·
verified ·
1 Parent(s): bfdeb71

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +92 -19
app.py CHANGED
@@ -1,19 +1,92 @@
1
- from transformers import pipeline
2
- import gradio as gr
3
-
4
- # Load QA model
5
- qa_model = pipeline("question-answering")
6
-
7
- # TutorPal AI logic
8
- def tutor_bot(question):
9
- context = """
10
- Newton's laws of motion are three physical laws that together laid the foundation for classical mechanics.
11
- Photosynthesis is the process by which green plants use sunlight to synthesize food from carbon dioxide and water.
12
- The mitochondrion is the powerhouse of the cell.
13
- The speed of light is approximately 3.0 × 10^8 m/s.
14
- """
15
- result = qa_model(question=question, context=context)
16
- return f"Hi, I'm TutorPal 👋\n\nHere's your answer:\n{result['answer']}"
17
-
18
- # Gradio app
19
- gr.Interface(fn=tutor_bot, inputs="text", outputs="text", title="📘 TutorPal - Assignment Helper").launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import 'package:flutter/material.dart';
2
+
3
+ void main() => runApp(ServiApp());
4
+
5
+ class ServiApp extends StatelessWidget {
6
+ @override
7
+ Widget build(BuildContext context) {
8
+ return MaterialApp(
9
+ title: 'Servi',
10
+ home: SplashScreen(),
11
+ );
12
+ }
13
+ }
14
+
15
+ class SplashScreen extends StatefulWidget {
16
+ @override
17
+ _SplashScreenState createState() => _SplashScreenState();
18
+ }
19
+
20
+ class _SplashScreenState extends State<SplashScreen> {
21
+ @override
22
+ void initState() {
23
+ super.initState();
24
+ Future.delayed(Duration(seconds: 3), () {
25
+ Navigator.pushReplacement(
26
+ context,
27
+ MaterialPageRoute(builder: (context) => SignInScreen()),
28
+ );
29
+ });
30
+ }
31
+
32
+ @override
33
+ Widget build(BuildContext context) {
34
+ return Scaffold(
35
+ backgroundColor: Colors.orange[100],
36
+ body: Center(
37
+ child: Column(
38
+ mainAxisAlignment: MainAxisAlignment.center,
39
+ children: [
40
+ Text('Servi', style: TextStyle(fontSize: 48, fontWeight: FontWeight.bold, color: Colors.black)),
41
+ SizedBox(height: 8),
42
+ Text('Your service, our priority', style: TextStyle(fontSize: 16, color: Colors.grey[700])),
43
+ ],
44
+ ),
45
+ ),
46
+ );
47
+ }
48
+ }
49
+
50
+ class SignInScreen extends StatelessWidget {
51
+ void _onGoogleSignIn() {
52
+ // Simulate sign-in process
53
+ print("Google Sign-In Clicked");
54
+ }
55
+
56
+ void _onFacebookSignIn() {
57
+ // Simulate sign-in process
58
+ print("Facebook Sign-In Clicked");
59
+ }
60
+
61
+ @override
62
+ Widget build(BuildContext context) {
63
+ return Scaffold(
64
+ backgroundColor: Colors.white,
65
+ body: Center(
66
+ child: Padding(
67
+ padding: EdgeInsets.symmetric(horizontal: 24),
68
+ child: Column(
69
+ mainAxisAlignment: MainAxisAlignment.center,
70
+ children: [
71
+ Text("Sign in to continue", style: TextStyle(fontSize: 20)),
72
+ SizedBox(height: 40),
73
+ ElevatedButton.icon(
74
+ icon: Icon(Icons.g_mobiledata),
75
+ label: Text("Continue with Google"),
76
+ style: ElevatedButton.styleFrom(backgroundColor: Colors.red),
77
+ onPressed: _onGoogleSignIn,
78
+ ),
79
+ SizedBox(height: 16),
80
+ ElevatedButton.icon(
81
+ icon: Icon(Icons.facebook),
82
+ label: Text("Continue with Facebook"),
83
+ style: ElevatedButton.styleFrom(backgroundColor: Colors.blue),
84
+ onPressed: _onFacebookSignIn,
85
+ ),
86
+ ],
87
+ ),
88
+ ),
89
+ ),
90
+ );
91
+ }
92
+ }