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
export class HomePage { | |
MovieName = ''; | |
url = environment.modelUrl; | |
public recommentList: any = []; | |
constructor(private http: HttpClient) {} | |
getRecommend() { | |
if (this.MovieName !== '') { | |
this.http.get(`${this.url}?name=${this.MovieName}`).subscribe((response) => { | |
console.log(response); | |
this.recommentList = response; |
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
<ion-header> | |
<ion-toolbar> | |
<ion-title> | |
Recommend Movies | |
</ion-title> | |
</ion-toolbar> | |
</ion-header> | |
<ion-content style="background-color: gainsboro;" [fullscreen]="true"> | |
<ion-header collapse="condense"> |
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
@app.route('/movie') | |
def main(): | |
name=request.args.get('name') | |
print(name) | |
if(name != None): | |
recom_array=recommend_movie(name) | |
print(recom_array) | |
try: | |
return recom_array.to_json(orient='records') | |
except: |
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
def recommend_movie(movieName,cosine_sim=cosine_sim): | |
try: | |
indx=indices[movieName] | |
score_tuple=list(enumerate(cosine_sim[indx])) | |
sorted_tuple=sorted(score_tuple,key=lambda x: x[1],reverse=True) | |
top_10_score=sorted_tuple[1:6] | |
top_10_index=[i[0] for i in top_10_score] | |
return movie_data[['title','spoken_languages','popularity','release_date','runtime','poster_path']].iloc[top_10_index] | |
except(Exception): | |
print('Erorr') |
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
movie_data = pd.read_csv('movies.csv') | |
#Vectorization of the Words | |
from sklearn.feature_extraction.text import TfidfVectorizer | |
tfidf = TfidfVectorizer(stop_words='english') | |
movie_data.overview=movie_data.overview.fillna('') | |
tfidf_matrix = tfidf.fit_transform(movie_data.overview) | |
#importing linear_kernel from sklearn to get the coorelation between each movie according the overview feature of dataset |
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
from flask import Flask,request,jsonify,Response | |
from flask_cors import CORS; | |
import pandas as pd | |
import json | |
app=Flask(__name__) | |
CORS(app) | |
#importing the dataset | |
movie_data = pd.read_csv('movies.csv') | |
#Vectorization of the Words |
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
goToSelectfile(event: any) { | |
this.fileObj = event.target.files[0]; | |
} | |
sendName() { | |
const uploadData = new FormData(); | |
uploadData.append('file', this.fileObj); | |
this.http.post('http://127.0.0.1:5000/getText', uploadData).subscribe((res: any) => { | |
this.show = true; | |
this.line = res.outputText; | |
this.sentiment = res.predSentiment; |
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
try: | |
from PIL import Image | |
except ImportError: | |
import Image | |
import pytesseract | |
def ocr_extraction(filename): | |
pytesseract.pytesseract.tesseract_cmd = r'C:/Users/intel/AppData/Local/Tesseract-OCR/tesseract.exe' | |
text=pytesseract.image_to_string(Image.open(filename)) | |
return(text) |
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
positive_fileids = movie_reviews.fileids('pos') | |
negative_fileids = movie_reviews.fileids('neg') |
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
features_positive = [(extract_features(movie_reviews.words(fileids=[f])),'Positive') for f in positive_fileids] | |
features_negative = [(extract_features(movie_reviews.words(fileids=[f])),'Negative') for f in negative_fileids] |
OlderNewer