Skip to content

Commit

Permalink
Few changes
Browse files Browse the repository at this point in the history
  • Loading branch information
iambetaraybill committed Jan 22, 2023
1 parent 68edfb0 commit 526fb4c
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 14 deletions.
4 changes: 3 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
"src/favicon.ico",
"src/assets"
],
"styles": [
"styles": ["node_modules/primeicons/primeicons.css",
"node_modules/primeng/resources/themes/lara-light-blue/theme.css",
"node_modules/primeng/resources/primeng.min.css",
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"src/styles.css"
Expand Down
38 changes: 37 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
"@popperjs/core": "^2.10.2",
"bootstrap": "^5.2.0",
"openai": "^3.1.0",
"primeicons": "^6.0.1",
"primeng": "^14.2.2",
"rxjs": "~7.5.0",
"tslib": "^2.3.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
Expand All @@ -40,6 +41,7 @@
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.0.0",
"karma-jasmine-html-reporter": "~1.7.0",
"tslib": "^2.4.1",
"typescript": "~4.7.2"
}
}
}
11 changes: 9 additions & 2 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ <h1> Generate <span>Image</span> from <span>Text</span></h1>
<div class="col"></div>
<div class="col-6">
<div class="form-group">
<textarea class="form-control" id="textArea" rows="4"
<textarea class="form-control" id="textArea" rows="4" [(ngModel)]="promtUser"
placeholder="Please Enter the description of the image you want to generate. A.I. will generate for You!😊"></textarea>
</div>
</div>
Expand All @@ -20,11 +20,18 @@ <h1> Generate <span>Image</span> from <span>Text</span></h1>
<div class="col"></div>
<div class="col-6" >
<div class="form-group" style="float:right;" id="buttonDiv">
<button >Create</button>
<button (click)="onClickButton()" [disabled]="hidden">Create</button>
</div>
</div>
<div class="col"></div>
</div>
<div class="row mt-2" *ngIf="imgURL.length > 0">
<div class="col"></div>
<div class="col-6">
<img [src]="imgURL" class="img-fluid" >
</div>
<div class="col"></div>
</div>
</div>
</div>
<div class="footer mt-0 mb-0 pt-0 pb-0 text-center">
Expand Down
20 changes: 14 additions & 6 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,26 @@ import { reqBody } from './req-res.interface';
export class AppComponent implements OnInit{
dateNow : Date = new Date();
hidden: boolean = false;
imgURL: string = '';
promtUser: string = '';
constructor(public http : HttpClient){

}

ngOnInit(): void {
// this.getImage();

}
onClickButton(){
this.getImage();
}
getImage(){
this.hidden = true;
let val : reqBody = {prompt: this.promtUser, n: 1, size: '1024x1024'}
this.createImage(val).subscribe(resp => {
this.imgURL = resp.data[0].url;
this.hidden = false;
})
}
// .subscribe(resp => {
// console.log(resp.data[0].url);
// })



createImage(inputBody: reqBody): Observable<any> {
const headers = { 'Authorization': `Bearer ${environment.OPENAI_API_KEY}` };
Expand Down
8 changes: 7 additions & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { HttpClientModule } from '@angular/common/http';
import { CommonModule } from '@angular/common';
import {ImageModule} from 'primeng/image';
import { FormsModule } from '@angular/forms';

@NgModule({
declarations: [
Expand All @@ -14,7 +17,10 @@ import { HttpClientModule } from '@angular/common/http';
BrowserModule,
AppRoutingModule,
NgbModule,
HttpClientModule
HttpClientModule,
CommonModule,
ImageModule,
FormsModule
],
providers: [],
bootstrap: [AppComponent]
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
"strictTemplates": false
}
}

0 comments on commit 526fb4c

Please sign in to comment.