This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import { Navigate, Outlet } from "react-router-dom"; | |
import { useAuth } from "../Context/AuthContex"; | |
const ProtectedRoutes = () => { | |
const { loggedIn } = useAuth(); | |
return loggedIn ? <Outlet /> : <Navigate to="/" />; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState, createContext, useContext } from "react"; | |
const AuthContext = createContext(); | |
function AuthProvider({ children }) { | |
const [loggedIn, setLoggedIn] = useState(false); | |
const login = () => { | |
setLoggedIn(true); | |
}; | |
const logout = () => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const path = require('path'); | |
const dotenv = require('dotenv'); | |
const ContactRoute = require('./Routes/ContactRoute'); | |
const app = express(); | |
dotenv.config(); | |
//middleware | |
app.use(express.static(path.resolve(__dirname, '../client/build'))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require("express"); | |
const path = require("path"); | |
const ContactRoute = require("./Routes/ContactRoute"); | |
const app = express(); | |
//middleware | |
app.use(express.static(path.resolve(__dirname, "../client/build"))); | |
app.use(express.json()); | |
app.use(express.urlencoded({ extended: true })); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require("express"); | |
const ContactController = require("../Controller/ContactController"); | |
const router = express.Router(); | |
router.route("/").post(ContactController.sendEmail); | |
module.exports = router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const nodemailer = require('nodemailer'); | |
exports.sendEmail = async (req, res) => { | |
try { | |
const outputMessage = ` | |
<h1>Mail Details</h1> | |
<ul> | |
<li>First Name: ${req.body.firstname}</li> | |
<li>Last Name: ${req.body.lastname}</li> | |
<li>Email: ${req.body.emailaddress}</li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let transporter = nodemailer.createTransport({ | |
host: "smtp.ethereal.email", | |
port: 587, | |
secure: false, // true for 465, false for other ports | |
auth: { | |
user: `${process.env.REACT_APP_EMAIL}`, // generated ethereal user | |
pass: `${process.env.REACT_APP_EMAIL_PASS}`, // generated ethereal password | |
}, | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gradio as gr | |
from transformers import AutoModelForSequenceClassification, AutoTokenizer, pipeline | |
model = AutoModelForSequenceClassification.from_pretrained("savasy/bert-base-turkish-sentiment-cased") | |
tokenizer = AutoTokenizer.from_pretrained("savasy/bert-base-turkish-sentiment-cased") | |
def greet(text): | |
pipe = pipeline("sentiment-analysis", tokenizer=tokenizer, model=model) | |
return pipe(text)[0]['label'] | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Import Swiper React components | |
import { Swiper, SwiperSlide } from "swiper/react"; | |
// Import Swiper styles | |
import "swiper/css"; | |
import "swiper/css/navigation"; | |
import "./style.css"; | |
// import required modules | |
import { Autoplay, Navigation } from "swiper"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.swiper { | |
width: 100%; | |
height: 100%; | |
} | |
.swiper-slide { | |
text-align: center; | |
font-size: 18px; | |
background: none; | |
display: -webkit-box; |